#pragma once
#include "d3dutil.h"
#include "LevelElement.h"
#include "Vertex.h"
#include <vector>

class NxActor;
class SkyBox;
class Skydome;
class Clouds;

class SkyModel : public LevelElement
{
public:
	/**
	* Creates a new SkyModel from a file name.
	* @param fileName the location of the SkyModel.
	* @param nrOfColumns the number of columns in the SkyModel.
	* @param nrOfRows the number of rows in the SkyModel.
	* @param tileSize the scale factor for the tiles.
	* @param scaleHeight the scale factor for the height.
	* @param offset a value to add to the height.
	*/
	enum Skytype 
	{
		SkyBox, 
		SkyDome
	};

	struct InitInfo
	{
		D3DXVECTOR3 CenterPosition;
		Skytype Type;
	};

	SkyModel(Level *pLevel, InitInfo& info);
	/*
	* Destroys the SkyModel object.
	*/
	virtual ~SkyModel(void);

	virtual void Initialize(ContentManager *pContentManager);
	virtual void Tick(const InputState & refInputState);
	virtual void Draw(const RenderContext* pRenderContext);
	virtual void DrawRefraction(const RenderContext* pRenderContext, D3DXPLANE refractionplane);
	virtual void DrawReflection(const RenderContext* pRenderContext, D3DXMATRIX reflectionviewmatrix, D3DXPLANE reflectionplane);
	virtual void DrawShadowMap(const RenderContext* pRenderContext){}

	float GetSunPos();
	D3DXVECTOR3 GetSunDirection();
	D3DXCOLOR GetSunColor();

private:		
	void calculateScatteringConstants();
	void computeAttenuation(float a_theta);

	//Sun variables
	D3DXVECTOR3 m_SunDirection;
	D3DXVECTOR3 m_LastSunDirection;

	float m_SunPos;
	float DegToRad;

	//Skydome vars
	Skydome* m_pSkydome;

	Clouds* m_pClouds;
	//Skydome2* m_pSkydome;
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	
	InitInfo& m_InitInfo;

	SkyModel(const SkyModel& t);
	SkyModel& operator=(const SkyModel& t);
};
